-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Implement otel retry metrics #12064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implement otel retry metrics #12064
Conversation
opentelemetry/src/main/java/io/grpc/opentelemetry/internal/OpenTelemetryConstants.java
Outdated
Show resolved
Hide resolved
opentelemetry/src/main/java/io/grpc/opentelemetry/GrpcOpenTelemetry.java
Show resolved
Hide resolved
@@ -64,8 +65,8 @@ public Stopwatch get() { | |||
}; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the gRFC has had recent updates, waiting for it to get merged before doing further changes...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there had been discussions yesterday about the recent changes to the retry metrics and whether they helped and such. The implementation should be mostly the same, but it isn't probably worth chasing the gRFC for the moment.
a7a16ce
to
3529769
Compare
3529769
to
bd69ed5
Compare
long hedgesPerCall = 0; | ||
long attempts = hedgedAttemptsPerCall.get(); | ||
if (attempts > 0) { | ||
hedgesPerCall = attempts - 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should hedges be subtracted by 1 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hedged attempts don't include the original attempt so we shouldn't subtract.
module.resource.clientCallDurationCounter() | ||
.record(callLatencyNanos * SECONDS_PER_NANO, attribute); | ||
module.resource.clientCallDurationCounter().record( | ||
callLatencyNanos * SECONDS_PER_NANO, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callLatencyNanos is already in nanos.
|
||
// Retry counts | ||
if (module.resource.clientCallRetriesCounter() != null) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Delete empty line.
} | ||
|
||
if (retriesPerCall > 0) { | ||
module.resource.clientCallRetriesCounter().record(retriesPerCall, baseAttributes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use attemptsPerCall.get() - 1 > = 0 ? attemptsPerCall.get() - 1 : 0
without creating local variables?
Optional<MetricData> metric = openTelemetryTesting.getMetrics().stream() | ||
.filter(m -> m.getName().equals(metricName)) | ||
.findFirst(); | ||
if (metric.isPresent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When will this metric not be present for the operations done by the tested on the tracer?
implements A96